package com.example.mvc.mapper;

import com.example.mvc.bean.Brand;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface BrandMapper {

    //查询所有
    @Select("select * from tb_brand")
    @ResultMap("brandResultMap")
    List<Brand> selectAll();
    //添加
    int add(Brand brand);


    //通过id查询到记录
    @Select("select * from tb_brand where id =#{id}")
    @ResultMap("brandResultMap")
    Brand getBrandById(int id);

    /**
     * 修改
     * @param brand
     */
    @Update("update tb_brand set brand_name = #{brandName},company_name = #{companyName},ordered = #{ordered},description = #{description},status = #{status} where id = #{id}")
    int upate(Brand brand);


    //删除
    int deleteById(int id);

}
